package com.myway.service.ibe.command;

import com.travelsky.ibe.client.pnr.BookPassenger;
import com.travelsky.ibe.client.pnr.PnrManage;

import java.util.Vector;

/**
 * Created by yufei on 2018/6/28.
 * 改期升舱，不需要换开票面
 */
public class ChangeAirSegmentPNRCommand extends BaseIBECommand{

    public String split(String pnr){//分离PNR
        PnrManage pm=new PnrManage();
        this.configIBEClient(pm);
        String name="test/adult";
        //第一步、创建要分离的旅客集合
        Vector passengers=new Vector();
        BookPassenger passenger;
        String pnrnew = null;
        try {
            passenger = new BookPassenger(name);
            //默认成人
            //对于含儿童的PNR，一般用RT的返回结果设置旅客类型
            //RTResult rs=new RTResult();
            //rs=new RT().retrieve(pnr);
            //passenger.setType(rs.getPassengerAt(n).getType());
            passengers.add(passenger);
            //第二步、分离旅客，返回新PNR号
            pnrnew = pm.splitPNR(pnr, passengers, 0);//在散客中count参数无意义
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return pnrnew;//新生成的PNR
    }
}
